package icu.sehnen.fitness.controller;


import icu.sehnen.fitness.common.CommonResult;
import icu.sehnen.fitness.entity.Coach;
import icu.sehnen.fitness.entity.News;
import icu.sehnen.fitness.service.ICoachService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author sehnen
 * @since 2021-04-26
 */
@Api(tags = "教练模块说明")
@RestController
@RequestMapping("/coach")
public class CoachController {
    @Autowired
    ICoachService iCoachService;
    @GetMapping("/list")
    @ApiOperation("查询所有教练接口")
    @PreAuthorize("hasAuthority('/wx/product/add')")
    public CommonResult<List<Coach>> findAll(@ApiParam("传入名字的模糊查询") String query){
        List<Coach> coachModelList= iCoachService.findAll(query);
        System.out.println(coachModelList);
        return  CommonResult.success(coachModelList);
    }


}
